#!/bin/sh

echo $1 | grep '@' >/dev/null

if [ X"$#" == X"1" -a X"$?" == X"0" ]; then
    EMAIL="$1"
else
    echo "USAGE: sh $0 user@domain.com"
    exit 255;
fi

counter=1

while [ $counter -lt 10 ]; do
    echo $counter
    cat /usr/local/share/doc/SpamAssassin/sample-spam.txt | \
    mail -s "Spam test" ${EMAIL}
    counter=$((counter+1))
done
